import { getRecommendBanner } from '@/api/recommend';
import { watchEffect } from 'vue';
import type { Ref } from 'vue';
import { ref } from 'vue';
type Banner={
    columnUrl: string;
    id: number;
    mainTitle: string;
    onlineType: boolean;
    picUrl: string;
    rank: number;
    vaildEndTime: number;
    vaildStartTime: number;
    viceTitle: string;
}
export function useRecommendbanHook() {
    let bannerList: Ref<Array<Banner>> = ref([]);
    let clickHandler=(columnUrl:string)=>{
        location.href=columnUrl
    }
    watchEffect(function(){
        getRecommendBanner()
            .then(res => {
                // console.log(res);
                if (res.data.code === '200') {
                    bannerList.value = res.data.data.navList;
                }
            })
    })
   
    return{
        bannerList,
        clickHandler
    }

}




